package com.mycompany.app.hr.eleave.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;

@Entity
@Table(name = "eleave_leave_period")
public class LeavePeriod {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "leave_period_id")
    private Long id;

    /**
     * 支持请半天假期 0--Whole day 1--First Half day 2--Second Half day
     */
    @Column(name = "leave_session")
    private Integer leaveSession;

    @Column(name = "from_date")
    private java.util.Date fromDate;

    @Column(name = "to_date")
    private java.util.Date toDate;

    @OneToOne(cascade=CascadeType.ALL)
    @JoinColumn(name = "leave_application_id")
    private LeaveApplication leaveApplication;

    // =======================================================
    @Override
    public String toString() {

        return ToStringBuilder.reflectionToString(this);
    }

    // =======================================================

    public Long getId() {

        return id;
    }

    public void setId(Long id) {

        this.id = id;
    }

    public Integer getLeaveSession() {

        return leaveSession;
    }

    public void setLeaveSession(Integer leaveSession) {

        this.leaveSession = leaveSession;
    }

    public java.util.Date getFromDate() {

        return fromDate;
    }

    public void setFromDate(java.util.Date fromDate) {

        this.fromDate = fromDate;
    }

    public java.util.Date getToDate() {

        return toDate;
    }

    public void setToDate(java.util.Date toDate) {

        this.toDate = toDate;
    }

    public LeaveApplication getLeaveApplication() {

        return leaveApplication;
    }

    public void setLeaveApplication(LeaveApplication leaveApplication) {

        this.leaveApplication = leaveApplication;
    }

}
